﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:my="clr-namespace:UniPie"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        xmlns:Xceed_Wpf_Toolkit_Core_Converters="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters;assembly=WPFToolkit.Extended"
        mc:Ignorable="d"
        x:Class="UniPie.MainWindow"
        Title="UniPie" Height="660" Width="880" WindowStyle="SingleBorderWindow" Closed="Window_Closed" Loaded="Window_Loaded" SizeChanged="Window_SizeChanged" Name="UniPie_window" Icon="/UniPie;component/Assets/UniPieIcon.png" Closing="Window_Closing" ResizeMode="CanMinimize" StateChanged="Window_StateChanged">
	<Window.Resources>
		<Xceed_Wpf_Toolkit_Core_Converters:InverseBoolConverter x:Key="InverseBoolConverter"/>
        <CollectionViewSource x:Key="behaviorViewSource" d:DesignSource="{d:DesignInstance my:Behavior, CreateList=True}" />
    </Window.Resources>
    <Grid>
    	<Grid.ColumnDefinitions>
    		<ColumnDefinition Width="0.289*"/>
    		<ColumnDefinition Width="0.711*" MinWidth="128"/>
    	</Grid.ColumnDefinitions>
    	<Grid.RowDefinitions>
    		<RowDefinition Height="355.792"/>
    		<RowDefinition Height="236.208"/>
    		<RowDefinition Height="40"/>
    	</Grid.RowDefinitions>
    	<Menu Height="20" VerticalAlignment="Top" Grid.ColumnSpan="2">
    		<MenuItem Header="File" Margin="0">
                <MenuItem Header="Save settings" Click="HandleSaveSettings" />
                <MenuItem Header="Exit" Click="HandleQuit" />
    		</MenuItem>
    		<MenuItem Header="Help" Margin="0" IsEnabled="False">
    			<MenuItem Header="Online help" IsEnabled="False" />
    			<MenuItem Header="About" IsEnabled="False" />
    		</MenuItem>
    	</Menu>
        <GroupBox Header="Behavior list" Margin="8,32,8,8">
    		<StackPanel Margin="8" DataContext="{StaticResource behaviorViewSource}">
    			<ListBox Height="241.35" DisplayMemberPath="Name" SelectedValuePath="Name" ItemsSource="{Binding}" SelectionChanged="HandleBehaviorSelectionChanged">
    			</ListBox>
    			<StackPanel Height="25.35" Orientation="Horizontal" Margin="0,8,0,0">
    				<Button Content="New" VerticalAlignment="Top" Click="HandleNewBehavior" />
    				<Button Content="Clone" VerticalAlignment="Top" Click="HandleDuplicateBehavior" />
    				<Separator Margin="0" Width="32" Visibility="Hidden"/>
    				<Button Content="Sort" VerticalAlignment="Top" Click="HandleSortBehaviors" />
    				<Separator Margin="0" Width="32" Visibility="Hidden"/>
    				<Button Content="Delete" VerticalAlignment="Top" Click="HandleDeleteBehavior" />
    			</StackPanel>
    		</StackPanel>
    	</GroupBox>
        <GroupBox Grid.Column="1" Header="Behavior setup" Margin="8,24,8,8" Grid.RowSpan="2" DataContext="{StaticResource behaviorViewSource}" >
    		<ScrollViewer PanningMode="VerticalOnly" RenderTransformOrigin="0.5,0.5">
    			<StackPanel>
    				<DockPanel x:Name="LabeledSeparator_Copy">
    					<Label Content="Name" FontWeight="Bold"/>
    					<Separator Height="8" Margin="0,0,8,0" DockPanel.Dock="Right"/>
    				</DockPanel>
    				<StackPanel x:Name="BehaviorName" Orientation="Horizontal" Margin="0,4" Visibility="Visible">
                        <Label Content="Behavior name" Width="96" HorizontalAlignment="Left"/>
                        <TextBox TextWrapping="Wrap" Text="{Binding Path=Name, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Width="160" HorizontalAlignment="Left"/>
    				</StackPanel>
    				<DockPanel x:Name="LabeledSeparator_Copy1">
    					<Label Content="Keyboard and mouse" FontWeight="Bold"/>
    					<Separator Height="8" Margin="0,0,8,0" DockPanel.Dock="Right"/>
    				</DockPanel>
    				<StackPanel x:Name="KeyboardMouseSetup" Orientation="Vertical" Width="575.992" Visibility="Visible">
    					<StackPanel Orientation="Horizontal" d:LayoutOverrides="Width">
    						<Label Content="Caller combo" HorizontalAlignment="Left" d:LayoutOverrides="HorizontalAlignment" Width="96"/>
                            <my:KeyboardMousePicker KeyboardMouseCombo="{Binding Path=TriggerState.KeyboardMouseCombo}" PropertyChanged="HandleKeyboardMousePickerChanged" d:LayoutOverrides="Width"/>
                            <StackPanel Orientation="Vertical" Opacity="0.495" VerticalAlignment="Center">
                            	<Label Content="Left click starts recording." Margin="0,0,-0.001,0" d:LayoutOverrides="Width"/>
                            	<Label Content="Leaving the area stops recording." Margin="0,0,-0.001,0" d:LayoutOverrides="Width"/>
                            	<Label Content="Right click clears the combo." Margin="0,0,-0.001,0" d:LayoutOverrides="Width"/>
                            </StackPanel>
    					</StackPanel>
    				</StackPanel>
    				<DockPanel x:Name="LabeledSeparator_Copy2">
    					<Label Content="Application" FontWeight="Bold"/>
    					<Separator Height="8" Margin="0,0,8,0" DockPanel.Dock="Right"/>
    				</DockPanel>
    				<StackPanel x:Name="ApplicationSetup" Orientation="Horizontal" Margin="0,4" Visibility="Visible">
    					<StackPanel Orientation="Horizontal">
                            <CheckBox Content="System wide" Width="96" VerticalAlignment="Center" IsChecked="{Binding Path=TriggerState.ApplicationFilter.IsSystemWide}" Name="CheckBox_SystemWide" />
    						<StackPanel>
    							<StackPanel Orientation="Horizontal">
                                    <Label Content="Caption contains" Width="96" HorizontalAlignment="Left" d:LayoutOverrides="Height" IsEnabled="{Binding IsChecked, Converter={StaticResource InverseBoolConverter}, ElementName=CheckBox_SystemWide}"/>
                                    <TextBox TextWrapping="Wrap" Text="{Binding Path=TriggerState.ApplicationFilter.WindowCaption, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Width="160" HorizontalAlignment="Left" IsEnabled="{Binding IsChecked, Converter={StaticResource InverseBoolConverter}, ElementName=CheckBox_SystemWide}"/>
    							</StackPanel>
    							<StackPanel Orientation="Horizontal">
                                    <Label Content="Class contains" Width="96" HorizontalAlignment="Left" d:LayoutOverrides="Height" IsEnabled="{Binding IsChecked, Converter={StaticResource InverseBoolConverter}, ElementName=CheckBox_SystemWide}"/>
                                    <TextBox TextWrapping="Wrap" Text="{Binding Path=TriggerState.ApplicationFilter.ApplicationClass, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Width="160" HorizontalAlignment="Left" IsEnabled="{Binding IsChecked, Converter={StaticResource InverseBoolConverter}, ElementName=CheckBox_SystemWide}"/>
    							</StackPanel>
    						</StackPanel>
    						<Label Content="(Separate multiple keywords with ; )" HorizontalAlignment="Left" VerticalAlignment="Center" Visibility="Hidden" />
    					</StackPanel>
    				</StackPanel>
    				<DockPanel x:Name="LabeledSeparator_Copy3" Visibility="Collapsed">
    					<Label Content="Screen area" FontWeight="Bold"/>
    					<Separator Height="8" Margin="0,0,8,0" DockPanel.Dock="Right"/>
    				</DockPanel>
    				<StackPanel x:Name="ScreenAreaSetup" Margin="0,4" Visibility="Collapsed">
    					<StackPanel Orientation="Horizontal">
    						<Label Content="Desktop" Width="96" HorizontalAlignment="Left" d:LayoutOverrides="Height"/>
    						<ComboBox Width="128" VerticalAlignment="Center">
    							<ComboBoxItem Content="Any" IsSelected="True"/>
    						</ComboBox>
    					</StackPanel>
    					<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
    						<Label Content="Area" Width="96" HorizontalAlignment="Left" d:LayoutOverrides="Height"/>
    						<UniformGrid Height="64" Width="64" Rows="3" Columns="3">
    							<CheckBox Content="" HorizontalAlignment="Left" VerticalAlignment="Top"/>
    							<CheckBox Content="" HorizontalAlignment="Center" VerticalAlignment="Top"/>
    							<CheckBox Content="" HorizontalAlignment="Right" VerticalAlignment="Top"/>
    							<CheckBox Content="" HorizontalAlignment="Left" VerticalAlignment="Center"/>
    							<CheckBox Content="" HorizontalAlignment="Center" VerticalAlignment="Center"/>
    							<CheckBox Content="" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,-0.001,0"/>
    							<CheckBox Content="" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
    							<CheckBox Content="" HorizontalAlignment="Center" VerticalAlignment="Bottom"/>
    							<CheckBox Content="" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,-0.001,0"/>
    						</UniformGrid>
    					</StackPanel>
    					<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,8,0,0">
    						<Label Content="Edge width" Width="96"/>
    						<xctk:IntegerUpDown Maximum="256" Minimum="1" Increment="16" Value="16" Width="44"/>
    						<Label Content="pixels" Width="96"/>
    					</StackPanel>
    				</StackPanel>
    				<DockPanel x:Name="LabeledSeparator_Copy4">
    					<Label Content="Remapping" FontWeight="Bold"/>
    					<Separator Height="8" Margin="0,0,8,0" DockPanel.Dock="Right"/>
    				</DockPanel>
    				<StackPanel x:Name="ActionRemapping" Margin="0,4" Visibility="Visible">
    					<CheckBox x:Name="CheckBox_UseRemapping" Content="Use remapping" IsChecked="{Binding Path=Response.UseRemapping}" />
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
    						<Label Content="Combo to send" Width="96" HorizontalAlignment="Left" IsEnabled="{Binding IsChecked, ElementName=CheckBox_UseRemapping}"/>
                            <my:KeyboardMousePicker KeyboardMouseCombo="{Binding Path=Response.RemappedCombo}" IsEnabled="{Binding IsChecked, ElementName=CheckBox_UseRemapping}" PropertyChanged="HandleKeyboardMousePickerChanged" />
    					</StackPanel>
                    </StackPanel>
    				<DockPanel x:Name="LabeledSeparator">
    					<Label Content="Pie" FontWeight="Bold"/>
    					<Separator Height="8" Margin="0,0,8,0" DockPanel.Dock="Right"/>
    				</DockPanel>
    				<StackPanel x:Name="PieSetup" Orientation="Horizontal" IsEnabled="{Binding IsChecked, Converter={StaticResource InverseBoolConverter}, ElementName=CheckBox_UseRemapping}">
                        <StackPanel x:Name="PieMenuType" Margin="8,0">
    						<DockPanel LastChildFill="False">
    							<Label Content="Pie menu type" VerticalAlignment="Top" Visibility="Collapsed"/>
    							<ComboBox Margin="0" VerticalAlignment="Top" IsReadOnly="True" SelectedIndex="0" Width="52" Visibility="Collapsed">
    								<ComboBoxItem Content="8 + 8" IsSelected="True"/>
    							</ComboBox>
    						</DockPanel>
    						<Border Background="#0C000000" Height="320" Margin="0,8,0,0" Width="320" CornerRadius="4" BorderBrush="#7F000000" BorderThickness="1">
                                <my:PieMenu SliceDefinitions="{Binding Path=Response.SliceDefinitions}" x:Name="PieMenuPreview" PreviewMode="True" PropertyChanged="HandlePieMenuChanged" />
    						</Border>
                        </StackPanel>
    					<StackPanel x:Name="SliceSetup" Margin="0">
    						<Separator Height="32" Margin="0,0,8,0" Visibility="Hidden"/>
                            <CheckBox Content="Slice enabled" HorizontalAlignment="Left" Margin="0,2" IsChecked="{Binding Path=SelectedSliceDefinition.IsEnabled, ElementName=PieMenuPreview}" Click="HandleSliceEnabledChanged" />
    						<StackPanel Orientation="Horizontal" Margin="0,4">
    							<Label Content="Slice text" Width="96" HorizontalAlignment="Left"/>
                                <TextBox TextWrapping="Wrap" Text="{Binding Path=SelectedSliceDefinition.Text, ElementName=PieMenuPreview, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Width="110" HorizontalAlignment="Left"/>
    						</StackPanel>
    						<StackPanel Orientation="Horizontal" Margin="0,4" Visibility="Collapsed">
    							<Label Content="Text orientation" Width="96" HorizontalAlignment="Left"/>
    							<StackPanel>
    								<RadioButton Content="Circumferential" IsChecked="True"/>
    								<RadioButton Content="Radial"/>
    							</StackPanel>
    						</StackPanel>
    						<StackPanel Orientation="Horizontal" Margin="0,4">
    							<Label Content="Slice hue" Width="96" HorizontalAlignment="Left"/>
                                <Slider Width="128" Maximum="1" TickPlacement="BottomRight" TickFrequency="0.125" IsSnapToTickEnabled="True" SmallChange="0.125" Value="{Binding Path=SelectedSliceDefinition.Hue, ElementName=PieMenuPreview}" LargeChange="0.25" />
    						</StackPanel>
    						<StackPanel Orientation="Horizontal" Margin="0,4">
    							<Label Content="Slice saturation" Width="96" HorizontalAlignment="Left"/>
                                <Slider Width="128" Maximum="1" TickPlacement="BottomRight" TickFrequency="0.125" IsSnapToTickEnabled="True" Value="{Binding Path=SelectedSliceDefinition.Saturation, ElementName=PieMenuPreview}" SmallChange="0.125" LargeChange="0.25" />
    						</StackPanel>
    						<StackPanel Orientation="Horizontal" Margin="0,4">
    							<Label Content="Keys to send" Width="96" HorizontalAlignment="Left" d:LayoutOverrides="HorizontalAlignment"/>
                                <my:KeyboardMousePicker d:LayoutOverrides="Width" KeyboardMouseCombo="{Binding Path=SelectedSliceDefinition.ComboToSend, ElementName=PieMenuPreview}" PropertyChanged="HandleKeyboardMousePickerChanged" />
    						</StackPanel>
    					</StackPanel>
    				</StackPanel>
    			</StackPanel>
    		</ScrollViewer>
    	</GroupBox>
    	<Separator Height="8" Margin="8,0" Grid.Row="2" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
    	<StackPanel Grid.Column="1" Margin="0,0,8,0" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" d:LayoutOverrides="Height" VerticalAlignment="Center">
            <Button Content="OK" Width="72" IsEnabled="True" Click="MinimizeWindow" />
    		<Separator Margin="0" Width="100" Visibility="Hidden"/>
            <Button Content="Quit" Width="72" Click="HandleQuit" />
    	</StackPanel>
    	<StackPanel Margin="8" Grid.Row="1">
    		<DockPanel>
    			<Label Content="Held combo"/>
    			<Label Content="Suppressed combo" DockPanel.Dock="Right" HorizontalAlignment="Right"/>
    		</DockPanel>
    		<DockPanel Height="180" Margin="0,8,0,0" >
    			<TextBlock x:Name="TextBlock_Held" Width="110" HorizontalAlignment="Left" Background="#0B000000" />
    			<TextBlock x:Name="TextBlock_Supp" Width="110" DockPanel.Dock="Right" HorizontalAlignment="Right" Background="#0B000000" />
    		</DockPanel>
    	</StackPanel>
    </Grid>
</Window>
